package com.meiyou.service.impl;

import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.meiyou.mapper.NewPinglunMapper;
import com.meiyou.pojo.DongtaiDianzan;
import com.meiyou.pojo.NewPinglun;
import com.meiyou.pojo.PinglunDianzan;
import com.meiyou.service.NewPinglunService;

@Service
public class NewPinglunServiceImpl implements NewPinglunService{

	@Autowired
	NewPinglunMapper pinglunMapper;
	
	
	public int addPinglun(NewPinglun pinglun) {
		
		Date date = new Date();
		pinglun.setShijian(date);
		return pinglunMapper.addPinglun(pinglun);
	}

	
	public List<NewPinglun> selectAllPinglunById(String dongtaiId) {
		
		List<NewPinglun> list = pinglunMapper.selectAllPinglunById(dongtaiId);
		return list;
	}

	
	public int addDongtaiDianzan(DongtaiDianzan dongtaiDianzan) {
		// TODO Auto-generated method stub
		Date date = new Date();
		dongtaiDianzan.setIsRead(1);
		dongtaiDianzan.setShijian(date);
		return pinglunMapper.addDongtaiDianzan(dongtaiDianzan);
	}

	
	public int quxiaoDongtaiDianzan(DongtaiDianzan dongtaiDianzan) {
		// TODO Auto-generated method stub
		return pinglunMapper.quxiaoDongtaiDianzan(dongtaiDianzan);
	}

	
	public int addPinglunDianzan(PinglunDianzan pinglunDianzan) {
		// TODO Auto-generated method stub
		Date date = new Date();
		pinglunDianzan.setIsRead(1);
		pinglunDianzan.setShijian(date);
		return pinglunMapper.addPinglunDianzan(pinglunDianzan);
	}

	
	public int quxiaoPinglunDianzan(PinglunDianzan pinglunDianzan) {
		// TODO Auto-generated method stub
		return pinglunMapper.quxiaoPinglunDianzan(pinglunDianzan);
	}

	
	public List<DongtaiDianzan> selectDongtaidianzanById(String dongtaiId) {
		// TODO Auto-generated method stub
		return pinglunMapper.selectDongtaidianzanById(dongtaiId);
	}

	
	public List<NewPinglun> selectDongtaiPinglunById(String dongtaiId) {
		// TODO Auto-generated method stub
		return pinglunMapper.selectDongtaiPinglunById(dongtaiId);
	}

	
	public List<NewPinglun> selectIsNotReadPinglun(String userId) {
		// TODO Auto-generated method stub
		return pinglunMapper.selectIsNotReadPinglun(userId);
	}

	
	public List<DongtaiDianzan> selectIsNotReadDontaiDianzan(String userId) {
		// TODO Auto-generated method stub
		return pinglunMapper.selectIsNotReadDontaiDianzan(userId);
	}

	
	public List<PinglunDianzan> selectIsNotReadPinglunById(String userId) {
		// TODO Auto-generated method stub
		return pinglunMapper.selectIsNotReadPinglunById(userId);
	}

	/*
	 * @Override public int updateNotReadToReadForPinglun() { // TODO Auto-generated
	 * method stub return pinglunMapper.updateNotReadToReadForPinglun(); }
	 * 
	 * @Override public int updateNotReadToReadForDongtaiDianzan() { // TODO
	 * Auto-generated method stub return
	 * pinglunMapper.updateNotReadToReadForDongtaiDianzan(); }
	 * 
	 * @Override public int updateNotReadToReadForPinglunDianzan() { // TODO
	 * Auto-generated method stub return
	 * pinglunMapper.updateNotReadToReadForPinglunDianzan(); }
	 */
}
